package cn.net.xyan.kotlin

import com.github.stuxuhai.jpinyin.PinyinFormat
import com.github.stuxuhai.jpinyin.PinyinHelper

/**
 * Created by zarra on 2017/7/7.
 */

val ChineseCharBegin: Char = 0x4e00.toChar()
val ChineseCharEnd: Char = 0x9FFF.toChar()


val Char.isChinese:Boolean get(){
    return this in (ChineseCharBegin + 1)..(ChineseCharEnd - 1)
}

val String.pinyin:String get() {
    return PinyinHelper.convertToPinyinString(this, "", PinyinFormat.WITHOUT_TONE)
}